Examining Racial Discrimination in the US Job Market

Background

Racial discrimination continues to be pervasive in cultures throughout the world. Researchers examined the level of racial discrimination in the United States labor market by randomly assigning identical résumés to black-sounding or white-sounding names and observing the impact on requests for interviews from employers.

Data

In the dataset provided, each row represents a resume. The 'race' column has two values, 'b' and 'w', indicating black-sounding and white-sounding. The column 'call' has two values, 1 and 0, indicating whether the resume received a call from employers or not.

Note that the 'b' and 'w' values in race are assigned randomly to the resumes when presented to the employer.

Exercises

You will perform a statistical analysis to establish whether race has a significant impact on the rate of callbacks for resumes.

Answer the following questions in this notebook below and submit to your Github account.

  1. What test is appropriate for this problem? Does CLT apply?
  2. What are the null and alternate hypotheses?
  3. Compute margin of error, confidence interval, and p-value.
  4. Write a story describing the statistical significance in the context or the original problem.
  5. Does your analysis mean that race/name is the most important factor in callback success? Why or why not? If not, how would you amend your analysis?

You can include written notes in notebook cells using Markdown:

Resources



In [1]:
import pandas as pd
import numpy as np
from scipy import stats

In [2]:
data = pd.io.stata.read_stata('data/us_job_market_discrimination.dta')

In [3]:
# number of callbacks for black-sounding names
sum(data[data.race=='b'].call)


Out[3]:
157.0

In [4]:
data.head()


Out[4]:
id ad education ofjobs yearsexp honors volunteer military empholes occupspecific ... compreq orgreq manuf transcom bankreal trade busservice othservice missind ownership
0 b 1 4 2 6 0 0 0 1 17 ... 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0
1 b 1 3 3 6 0 1 1 0 316 ... 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0
2 b 1 4 1 6 0 0 0 0 19 ... 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0
3 b 1 3 4 6 0 1 0 1 313 ... 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0
4 b 1 3 3 22 0 0 0 0 313 ... 1.0 1.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 Nonprofit

5 rows × 65 columns

1) What test is appropriate for this problem? Does CLT apply?

we can perform a permutation test with the two samples. The Central Limit does apply.

2) What are the null and alternate hypotheses?

$H_0$: The race of a person has no bearing on whether he/she receives a callback.

$H_A$: The race of a person gives affects the callback rate.

3) Compute margin of error, confidence interval, and p-value.


In [5]:
white = data[data['race'] == 'w']['call']
black = data[data['race'] == 'b']['call']

diff_of_means = np.abs(np.mean(white) - np.mean(black))

In [6]:
# assuming alpha = 0.05
SE = np.sqrt(np.std(white) ** 2 / len(white) + np.std(black) ** 2 / len(black))

margin_of_error = 1.96 * SE

confidence_interval = [diff_of_means - margin_of_error, diff_of_means + margin_of_error]

print('The margin of error is', margin_of_error)
print('The 95% confidence interval is', confidence_interval)


The margin of error is 0.0152552843854
The 95% confidence interval is [0.016777570469610682, 0.047288139240510473]

In [7]:
permutation_replicates = np.empty(100000)

for i in range(len(permutation_replicates)):
    permutation_samples = np.random.permutation(np.concatenate((white, black)))
    
    white_perm = permutation_samples[:len(white)]
    black_perm = permutation_samples[len(white):]
    
    permutation_replicates[i] = np.abs(np.mean(white_perm) - np.mean(black_perm))

p = np.sum(permutation_replicates > diff_of_means) / len(permutation_replicates)
print('p =', p)


p = 2e-05

4) Write a story describing the statistical significance in the context or the original problem.

Racial discrimination is currently an issue in the US job market. In this report we investigated to see whether the data agrees with this. A permutation test between the black and white samples was ran to see if the differences between the callback means are statistically significant. A very low p value was calculated which means our null hypothesis can be rejected. We can conclude that the race/name of a job applicant does affect the callback rate.

5) Does your analysis mean that race/name is the most important factor in callback success? Why or why not? If not, how would you amend your analysis?

The analysis does not necessarily mean that race/name is the most important factor in callback success. From the analysis, we can only confirm that race/name is one of the factors that affect callback. Further investigation must be completed with the other columns of data that is available in order to determine which factors are more or less important.